package com.itheima.demo.demo11;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Service1 {
    public static void main(String[] args) throws IOException {
        System.out.println("服务端启动，等待连接");
        ServerSocket ss=new ServerSocket(8888);
        Socket accept = ss.accept();
        //然后需要度数据了
        InputStream is = accept.getInputStream();
        int len=0;
        byte[]b=new byte[1024];
        while ((len=is.read(b))!=-1){
            System.out.println("客户端说的是"+new String(b,0,len));
        }//这里我只是读取了客户端发的信息，斌没有给客户端反馈输出
        OutputStream os = accept.getOutputStream();
         os.write("系统格尼反馈的".getBytes());


        is.close();
        ss.close();
        accept.close();

    }
}
